package cn.ly.recursion.towers;

public class Towers {
	
	static int nDisk = 3;
	public static void main(String[] args) {
		doTowers(3,'a','b','c');
	}
	
	public static void doTowers(int topN,char from,char inter,char to){
		if(topN == 1){
			System.out.println("disk 1 from " + from + " to " + to);
		}else{
			//此时需要把盘子移动到中介它上，所以把inter做为目标塔的参数，而to做为中介塔使用
			doTowers(topN-1,from,to,inter);
			System.out.println("disk " + topN + " from " + from + " to " + to);
			doTowers(topN-1,inter,from,to);
		}
	}

}
